//
// Created by Jisam on 2024年10月30日17:30:11.
// Solution of  P3558 [POI2013] BAJ-Bytecomputer
#include <bits/stdc++.h>

#define int long long
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;
const int MAXN = 1000010;
int a[MAXN];
int dp[MAXN][5];
signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin>>n;
	for(int i = 1;i <= n;i ++)cin >> a[i];
	dp[1][0] = dp[1][1] = dp[1][2] = INT_MAX;
	dp[1][a[1] + 1] = 0;
	for(int i = 2;i <= n;i ++){
		if(a[i] == -1){
			dp[i][0] = dp[i - 1][0];
			if(a[i - 1] == 1)dp[i][1] = min(dp[i - 1][0],dp[i - 1][1]) + 1;
			else dp[i][1] = INT_MAX;
			if(a[i - 1] == 1)dp[i][2] = min({dp[i - 1][0],dp[i - 1][1],dp[i - 1][2]}) + 2;
			else dp[i][2] = dp[i - 1][2] + 2;
		}
		if(a[i] == 0){
			dp[i][0] = dp[i - 1][0] + 1;
			dp[i][1] = min(dp[i - 1][0],dp[i - 1][1]);
			if(a[i - 1] == 1)dp[i][2] = min({dp[i - 1][0],dp[i - 1][1],dp[i - 1][2]}) + 1;
			else dp[i][2] = dp[i - 1][2] + 1;
		}
		if(a[i] == 1){
			dp[i][0] = dp[i - 1][0] + 2;
			if(a[i - 1] == -1)dp[i][1] = min(dp[i - 1][0],dp[i - 1][1]) + 1;
			else dp[i][1] = dp[i - 1][0] + 1;
			dp[i][2] = min({dp[i - 1][0],dp[i - 1][1],dp[i - 1][2]});
		}
	}
	if(min({dp[n][0],dp[n][1],dp[n][2]}) < INT_MAX)cout<<min({dp[n][0],dp[n][1],dp[n][2]});
	else cout<<"BRAK";
    return 0;
}